package com.yb0os1;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.concurrent.atomic.AtomicLong;

@DubboService(version = "1.0.0")
public class DemoServiceImpl implements DemoService{

    // nacos.config.autoRefresh = true 这个配置要打才可以
    @NacosValue(value = "${dubboParams}", autoRefreshed = true)
    private String dubboParams;

    private AtomicLong atomicLong = new AtomicLong(0);

    @Override
    public String getString() {

        long l = atomicLong.incrementAndGet();
        try {
            Thread.sleep(1000 - (100 * l));
        }catch (Exception e) {
            e.printStackTrace();
        }
        return dubboParams;
    }
}
